package main

import (
	"flag"
	"fmt"
	"go.uber.org/zap"
	"google.golang.org/grpc"
	"heightFive/Day_exam/day3/userRpc/handle"
	_ "heightFive/Day_exam/day3/userRpc/initialize"
	user "heightFive/Day_exam/day3/userRpc/proto"
	"log"
	"net"
)

func main() {
	zap.S().Infow(
		"Service启动成功：：：",
		zap.String("host", "0.0.0.0"),
		zap.Int("Port", 8080))
	flag.Parse()
	lis, err := net.Listen("tcp", fmt.Sprintf(":%d", 8080))
	if err != nil {
		log.Fatalf("Failed to listen: %v", err)
	}
	s := grpc.NewServer()
	user.RegisterUserServer(s, &handle.UserServer{})
	log.Printf("server listening at %v", lis.Addr())
	if err := s.Serve(lis); err != nil {
		log.Fatalf("failed to serve: %v", err)
	}
}
